package com.huangjue.backend.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.reactive.function.client.WebClient;


//流式输出的请求和接收
@Configuration
public class WebClientConfig {
    @Bean
    public WebClient webClient(@Value("${llm.qianfan.apiUrl}") String baseUrl,
                               @Value("${llm.qianfan.apiKey}") String apiKey) {
        return WebClient.builder()
                .baseUrl(baseUrl)
                .defaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + apiKey)
                .build();
    }
}